package util;

public final class Message {
  
    public int what;
    public int arg1;
    public int arg2;
    public Object obj;
    
    
	
    public Message(int what, int arg1, int arg2, Object obj) {
		super();
		this.what = what;
		this.arg1 = arg1;
		this.arg2 = arg2;
		this.obj = obj;
	}

	public Message() {
	}

	public int getArg1() {
		return arg1;
	}

	public void setArg1(int arg1) {
		this.arg1 = arg1;
	}

	public int getArg2() {
		return arg2;
	}

	public void setArg2(int arg2) {
		this.arg2 = arg2;
	}

	public int getWhat() {
		return what;
	}

	public void setWhat(int what) {
		this.what = what;
	}

	public Object getObj() {
		return obj;
	}

	public void setObj(Object obj) {
		this.obj = obj;
	}
	
	@Override
	public String toString() {
		try {
			return "[what= "+ what +  " arg1= " + arg1 + " arg2= "+ arg2 + " obj= " + new String((byte[])obj).substring(0, 6) + "...]";
		} catch (StringIndexOutOfBoundsException e) {
			return "[what= "+ what +  " arg1= " + arg1 + " arg2= "+ arg2 + " obj= ... ";
		}
		
	}
    
    
}
